| Conditions | 7 | 
| Total Lines | 56 | 
| Code Lines | 51 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React, { Component } from "react" | 
            ||
| 87 |   renderPlayerStats = (player) => { | 
            ||
| 88 |     if (this.state.loading === false && this.state.data) { | 
            ||
| 89 |       const { | 
            ||
| 90 | playerStatistics = [],  | 
            ||
| 91 | goals = [],  | 
            ||
| 92 | gameReports = [],  | 
            ||
| 93 | } = this.state.data  | 
            ||
| 94 | |||
| 95 | return (  | 
            ||
| 96 |         <aside className={"player-detail__statistics"}> | 
            ||
| 97 |           <section className={"player-detail__statistics-item"}> | 
            ||
| 98 |             <div className={"player-detail__statistics-item__number"}> | 
            ||
| 99 |               {playerStatistics[0]?.gamesPlayed || "0"} | 
            ||
| 100 | </div>  | 
            ||
| 101 |             <div className={"player-detail__statistics-item__label"}> | 
            ||
| 102 | Wedstrijden  | 
            ||
| 103 | </div>  | 
            ||
| 104 | </section>  | 
            ||
| 105 | |||
| 106 |           {(player.field_position === "k" || player.field_position === "d") && ( | 
            ||
| 107 |             <section className={"player-detail__statistics-item"}> | 
            ||
| 108 |               <div className={"player-detail__statistics-item__number"}> | 
            ||
| 109 |                 {playerStatistics[0]?.cleanSheets || "0"} | 
            ||
| 110 | </div>  | 
            ||
| 111 |               <div className={"player-detail__statistics-item__label"}> | 
            ||
| 112 | Cleansheets  | 
            ||
| 113 | </div>  | 
            ||
| 114 | </section>  | 
            ||
| 115 | )}  | 
            ||
| 116 |           {player.field_position !== "k" && ( | 
            ||
| 117 |             <section className={"player-detail__statistics-item"}> | 
            ||
| 118 |               <div className={"player-detail__statistics-item__number"}> | 
            ||
| 119 |                 {playerStatistics[0]?.goals || "0"} | 
            ||
| 120 | </div>  | 
            ||
| 121 |               <div className={"player-detail__statistics-item__label"}> | 
            ||
| 122 | Doelpunten  | 
            ||
| 123 | </div>  | 
            ||
| 124 | </section>  | 
            ||
| 125 | )}  | 
            ||
| 126 |           <section className={"player-detail__statistics-item"}> | 
            ||
| 127 |             <div className={"player-detail__statistics-item__number"}> | 
            ||
| 128 |               {playerStatistics[0]?.yellowCards || "0"} | 
            ||
| 129 | </div>  | 
            ||
| 130 |             <div className={"player-detail__statistics-item__label"}> | 
            ||
| 131 | Gele kaarten  | 
            ||
| 132 | </div>  | 
            ||
| 133 | </section>  | 
            ||
| 134 |           <section className={"player-detail__statistics-item"}> | 
            ||
| 135 |             <div className={"player-detail__statistics-item__number"}> | 
            ||
| 136 |               {playerStatistics[0]?.redCards|| "0"} | 
            ||
| 137 | </div>  | 
            ||
| 138 |             <div className={"player-detail__statistics-item__label"}> | 
            ||
| 139 | Rode kaarten  | 
            ||
| 140 | </div>  | 
            ||
| 141 | </section>  | 
            ||
| 142 | </aside>  | 
            ||
| 143 | )  | 
            ||
| 257 |